﻿using StarPizza.Model.BaseModel;
using StarPizza.Model.Core;
using StarPizza.Model.User;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace StarPizza.ViewModel.Core
{
    public class ToppingLister : IngredientLister<Topping, ToppingVM>
    {
        public ToppingLister(IIngredientResource ingredientResource, IUserModeManager userModeManager)
            : base(ingredientResource, userModeManager)
        {
            SetupIngredients();
            ingredientResource.ToppingStorageChanged += IngredientStorageChanged;
            ingredientResource.ToppingCreated += ingredientResource_ToppingCreated;
        }
        void ingredientResource_ToppingCreated(Topping topping)
        {
            RegisterIngredient(ingredient: topping);
        }
        protected override ToppingVM CreateIngredientVM(Topping topping)
        {
            return new ToppingVM(topping);
        }
        protected override IEnumerable<Topping> GetSpecificIngredients()
        {
            return ingredientResource.GetToppings();
        }
    }
}
